/* eslint-disable class-methods-use-this */
import {
  post,
  get,
  put,
  _delete,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Staff {
  async getStaffList(page, limit, info) {
    const res = await get(`v1/staff?page=${page}&limit=${limit}`, info)
    return res
  }

  async getStaffInfo(id) {
    const res = await get(`v1/staff/${id}`)
    return res
  }

  async createStaff(info) {
    const res = await post('v1/staff', info)
    return res
  }

  async updateStaff(info) {
    const res = await put('v1/staff', info)
    return res
  }

  async deleteStaff(id) {
    const res = await _delete(`v1/staff/${id}`)
    return res
  }
}

export default new Staff()
